package com.buba.controller;

import com.buba.service.FollowUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import result.CommonResult;

/**
 * @Author: 孔德嘉
 * @Description: TODO关注的人
 * @DateTime: 2023/3/6 19:44
 **/
@RestController
@CrossOrigin
public class FollowUserController {
    //注入
    @Autowired
    private FollowUserService followUserService;
    /*
    * @param id
    * @return result.CommonResult
    * @author kdj
    * @describe:查询关注人的发布的日记话题
    * @date 2023/3/6 19:46
    */
    @GetMapping("/getFollowUserIndexList")
    public CommonResult getFollowUserIndexList(int id){
        return CommonResult.ok(followUserService.getFollowUserIndexList(id));
    }

    /*
     * @param coverUserId 被关注id
     * @param userId 用户id
     * @return result.CommonResult
     * @author kdj
     * @describe:修改用户被关注状态
     * @date 2023/3/9 11:52
     */
    @GetMapping("/updateFollowUserByUserId")
    public CommonResult updateFollowUserByUserId(int coverUserId,int userId){
        return CommonResult.ok(followUserService.updateFollowUserByUserId(coverUserId,userId));
    }
}
